# 连等式
# a = '123'
# res = 1 < len(a) < 2        #false

# 生成器转集合
# gen = (i for i in [1,2,3])
# res = set(gen)      # {1, 2, 3}

# 集合推导式
# res = {i for i in [1,2,3]}
# print(res)      #{1, 2, 3}
#
# import random
# for i in range(9):
#     print(str(random.randint(0,9)), end='')

# map和in
# dict = [{'id':1},{'id':2},{'id':3},{'id':4}]
# print(1 in map(lambda x:x.get('id'), dict))     # True
# import requests
# res = requests.get('https://restapi.amap.com/v3/geocode/geo?address=黑龙江省尚志市苇河镇 ;北京市东城区景山前街&output=JSON&key=5e5314fd7867bae494566df784aee47c')
#
# print(res.json().get('geocodes'))
# print(res.json().get('geocodes')[0].get('location'))

# 坐标缩放


# import math
# #定义点的函数
# class Point:
#     def __init__(self,x=0,y=0):
#         self.x=x
#         self.y=y
#     def getx(self):
#         return self.x
#     def gety(self):
#         return self.y
# #定义直线函数
# class Getlen:
#     def __init__(self,p1,p2):
#         self.x=p1.getx()-p2.getx()
#         self.y=p1.gety()-p2.gety()
#         #用math.sqrt（）求平方根
#         self.len= math.sqrt((self.x**2)+(self.y**2))
#     #定义得到直线长度的函数
#     def getlen(self):
#         return self.len
#
# def locational(location_list):
# #设置点p1的坐标为（0,0）
#     print(location_list[0].split(','))
#     p1=Point(float(location_list[0].split(',')[0]),float(location_list[0].split(',')[1]))
#     #设置点p2的坐标为（3,4）
#     p2=Point(float(location_list[1].split(',')[0]),float(location_list[1].split(',')[1]))
#     l=Getlen(p1,p2)
# #获取两点之间直线的长度
#     return 7 - l.getlen() // 6
#
# if __name__ == '__main__':
#     location_list = ['113.018920,28.209023', '120.649451,28.209023']
#     distance = locational(location_list)
#     print(7 - distance // 6)

# from math import sin, asin, cos, radians, fabs, sqrt, floor
# import random
# import datetime
#
# EARTH_RADIUS = 6371  # 地球平均半径，6371km
#
# def hav(theta):
#     s = sin(theta / 2)
#     return s * s
#
#
# def get_distance_hav(lat0, lng0, lat1, lng1):
#     "用haversine公式计算球面两点间的距离。"
#     # 经纬度转换成弧度
#     lat0 = radians(lat0)
#     lat1 = radians(lat1)
#     lng0 = radians(lng0)
#     lng1 = radians(lng1)
#
#     dlng = fabs(lng0 - lng1)
#     dlat = fabs(lat0 - lat1)
#     h = hav(dlat) + cos(lat0) * cos(lat1) * hav(dlng)
#     distance = 2 * EARTH_RADIUS * asin(sqrt(h))
#
#     return distance
#
# def resultLog():
#
#     start_location = '113.018920,28.209023'
#     end_location = '126.649451,45.792113'
#     start_lat, start_lon = float(start_location.split(',')[1]), float(start_location.split(',')[0])
#     end_lat, end_lon = float(end_location.split(',')[1]), float(end_location.split(',')[0])
#     distance = get_distance_hav(start_lat, start_lon, end_lat, end_lon)
#
#     period = 1.5
#     # 设每小时100公里
#     # 每个周期行进的距离：
#     per = period / 60 * 100
#     print(per)
#
#     # 周期数
#     current = int(floor(distance / per))
#     print(current)
#
#     # 高温
#     high_temp = 8
#     # 低温
#     low_temp = 2
#
#
#     mu =  (high_temp + low_temp) / 2
#
#     sigma = 1
#
#     # 超温次数
#     j = 0
#     # 记录结果
#     record= []
#     now = datetime.datetime.now()
#     delta = datetime.timedelta(seconds=period * 60)
#     for i in range(current):
#         rec = {}
#         # 时间
#         n_days = now + (delta * i)
#         rec['time'] = n_days.strftime('%Y-%m-%d %H:%M:%S')
#         # 正态分布随机温度
#         temp = random.normalvariate(mu=mu, sigma=sigma)
#         rec['temp'] = temp
#         if temp < low_temp or temp > high_temp:
#             j += 1
#             rec['judge'] = '超温'
#         else:
#             rec['judge'] = '正常'
#         rec['lon'] = start_lon + (((start_lon - end_lon) / current) * i)
#         rec['lat'] = start_lat + (((start_lat - end_lat) / current) * i)
#         record.append(rec)
#     return record
# import json
# res = json.dumps({'a':1,'b':'中文'}, ensure_ascii=False)
# print(res)
# print(type(res))
import random
print(random.random())